In testing a computer program, exercising a small portion of the program in isolation, such as a unit test, is often a good way to find bugs or other inefficiencies in the tested portion. Thus, a significant consideration when developing a unit test is isolation.
In object-oriented programs, one way to achieve the desired isolation is by creating a mock (or mock object), comprising a counterpart object to a real object (which may be a class depending on the programming environment) that adheres to a particular interface but typically provides only a basic or non-functional implementation. Because of its simplicity, a mock object is highly unlikely to contain any bugs. Testing one object while mocking (one or more of) the other objects on which the object under test depends allows for a high degree of isolation of the tested object.
However, a problem with mock objects is that generating and maintaining the mock objects is very tedious and time-consuming. For example, every time a developer changes the interface, method or other portion of a real program object, the developer (or other person on the team) also needs to change the corresponding mock counterpart.